﻿// 漂流瓶v4.3.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include<iostream>
#include<iomanip>
#include<string> 
#include<ctime>
#include<cstdlib>
#include<vector>
#include<fstream>
#include<sstream>
using namespace std;

string gettime() {
	time_t current_time = time(NULL);
	tm* time_info = localtime(&current_time);

	// 格式化时间
	ostringstream oss;
	oss << put_time(time_info, "%Y-%m-%d-%H:%M:%S");
	return oss.str();
}

class User {
public:
	bool Register(string oID, string oName, string oPassword);
	int Login(string iID, string iPassword, string& name);
	bool IsRepetition(string oID);
	void Loading();

	//private:
	vector<string> ID;
	vector<string> Name;
	vector<string> Password;

};

bool User::IsRepetition(string oID)
{
	for (int i = 0; i < ID.size(); i++)
	{
		if (ID[i] == oID)
			return true;
	}
	return false;
}

bool User::Register(string oID, string oName, string oPassword)
{
	ofstream outfile("User_in.txt", ios::app);
	if (!outfile)
	{
		cout << "请检查信息文件!" << endl;
		return false;
	}

	outfile << oID << " " << oName << " " << oPassword << endl;

	ID.push_back(oID);
	Name.push_back(oName);
	Password.push_back(oPassword);
	outfile.close();
	cout << "***注册成功，正在跳转，请稍等***" << endl;
	cout << "您的注册信息为：" << endl;
	cout << "ID:" << oID << endl << "姓名:" << oName << endl << "密码:" << oPassword << endl;
	return true;
}

int User::Login(string iID, string iPassword, string& name) {
	int length = iPassword.size();
	for (int i = 0; i < ID.size(); i++) {
		if (iID == ID[i]) {
			int length1 = Password[i].size();
			cout << "ID正确！" << endl;
			//cout << Password[i]<<sizeof(Password[i]) << endl;
			if (iPassword == Password[i] && length == length1) {
				cout << "密码正确!" << endl;
				cout << "******登陆成功！请稍后******" << endl;
				cout << "您的个人信息为：" << endl;
				cout << "ID:" << iID << endl << "姓名:" << Name[i] << endl;
				name = Name[i];
				return 0;
			}
		}
	}
	cout << "您输入的账号或密码有误！请重新输入！" << endl;
	return 1;
}

size_t findspaceoutside(const string& str, int x = 2) {
	size_t spaceCount = 0;
	bool insideQuotes = false;

	for (size_t i = 0; i < str.length(); ++i) {
		if (str[i] == '"') {
			insideQuotes = !insideQuotes; // 切换引号状态
		}
		else if (!insideQuotes && str[i] == ' ') {
			spaceCount++;
			if (spaceCount == x) {
				return i; // 返回第x个引号外的空格的位置
			}
		}
	}
	return static_cast<size_t>(-1); // 如果没有找到足够的引号外空格，返回-1或其他指示值
}

void User::Loading() {
	ifstream infile("User_in.txt");
	if (!infile) {
		cout << "请检查信息文件或注册一个账号后重进！" << endl;
	}
	string line;
	while (getline(infile, line)) {
		string id, name, password;
		size_t pos = 0;
		//提取&加载ID信息 
		pos = line.find_first_of(' ');
		id = line.substr(0, pos);
		ID.push_back(id);
		//提取&加载姓名信息 
		name = line.substr(id.size() + 1);
		pos = name.find_first_of(' ');
		name = name.substr(0, pos);
		Name.push_back(name);
		//提取&加载密码信息 
		password = line.substr(id.size() + name.size() + 2);
		//cout << password << endl;
		Password.push_back(password);

		/*stringstream ss(line);
		getline(ss,id,' ');
		getline(ss,name,' ');
		getline(ss,password,';');
		ID.push_back(id);
		Name.push_back(name);
		Password.push_back(password);*/
	}
	infile.close();
	ofstream refile("Reply_message.txt", ios::app);
	refile.close();
	ofstream out("friend.txt", ios::app);
	out.close();
	ofstream Readfile("漂流瓶.txt", ios::app);
	Readfile.close();
	ofstream put("achievement.txt", ios::app);
	put.close();
	ofstream check("check.txt", ios::app);
	check.close();
	ofstream chat("chat.txt", ios::app);
	chat.close();
}

bool pick_bottle(string& Rc, string &name){
	ifstream Readfile("漂流瓶.txt", ios::in);
	string Re;
	int random;
	if (!Readfile)//文件打开失败:返回0
	{
		cout << "无法打开文件!请检查或创建之后重新进入!" << endl;
		return false;
	}
	vector<string> lines;
	string line;
	while (getline(Readfile, line)) {
		lines.push_back(line);
	}
	Readfile.close();

	if (lines.empty()) {
		cout << "暂无漂流瓶！" << endl;
		return false;
	}

	else {
		int i, k = 0;
		string str0;
		for (i = 0; i < lines.size(); i++) {
			size_t x = 0, y = 0;
			x = findspaceoutside(lines[i], 1);
			y = findspaceoutside(lines[i], 2);
			str0 = lines[i].substr(x + 8, y - x - 8);
			//cout << str0 <<"!"<< endl;
			if (str0 != name) k++;
		}
		if (k == 0) {
			cout << "暂无漂流瓶！" << endl;
			return false;
		}
	}
	size_t size = lines.size();
	srand((unsigned int)time(NULL));
	do {
		size_t p = 0;
		random = rand() % (size);
		Re = lines[random];
		p = findspaceoutside(Re, 1);
		Re = Re.substr(p + 8);
		p = Re.find_first_of(" ");
		Re = Re.substr(0, p);
		//cout << Re <<"!"<< endl;
	} while (Re == name);
	if (Re != name) {
		cout << "捡到一个漂流瓶：" << endl;
		string str = lines[random], begin;
		size_t pos = 0, pos1 = 0, pos2 = 0;
		const string basis = "Hide";
		pos = findspaceoutside(str, 1);
		begin = str.substr(0, 4);
		//cout << cname << endl;
		if (begin == basis) {
			pos1 = findspaceoutside(str, 1);
			pos2 = findspaceoutside(str, 2);
			string str1 = str.substr(4, pos1 - 3);
			string str2 = str.substr(pos2);
			//cout << str1<<"!"<<endl;
			string str3 = str1 + "发送者:匿名" + str2;
			cout << str3 << endl;
			str = str.substr(pos1 + 8, pos2 - pos1 - 8);
			Rc = "Hide" + str;
			//cout << Rc<<endl;
		}
		else {
			size_t pos3 = findspaceoutside(str, 1);
			size_t pos4 = findspaceoutside(str, 2);
			str = str.substr(pos3 + 8, pos4 - pos3 - 8);
			cout << lines[random] << endl;
			Rc = str;
		}
	}
	//cout << str << endl;

	return true;
}

bool throw_bottle(string &name) {
	ofstream wout("漂流瓶.txt", ios::app);
	if (!wout)
	{
		cout << "请检查信息文件" << endl;
		return false;
	}
	cout << "你想匿名发送吗?(y/Y)" << endl;
	char op;
	cin >> op;
	cin.ignore(numeric_limits<streamsize>::max(), '\n');
	string words;
	cout << "请写下你想说的话：" << endl;
	getline(cin, words);
	if (op == 'y' || op == 'Y') {

		wout << "Hide" << '"' << words << '"' << " " << "发送者:" << name << " " << "时间:" << gettime() << endl;
	}
	else {
		wout << '"' << words << '"' << " " << "发送者:" << name << " " << "时间:" << gettime() << endl;
	}
	cout << "您已成功扔出一个漂流瓶！" << endl;
	wout.close();
}

bool Reply_message(string &name, string Rc) {
	ofstream refile("Reply_message.txt", ios::app);
	if (!refile) {
		cout << "请检查信息文件" << endl;
		return false;
	}
	cout << "你想要匿名回复吗？(y/Y)" << endl;
	char op;
	cin >> op;
	cin.ignore(numeric_limits<streamsize>::max(), '\n');
	cout << "请写下你想回复的消息:" << endl;
	string message;
	getline(cin, message);
	if (op == 'y' || op == 'Y') {
		refile << "Hide" << '"' << message << '"' << " " << "回复人:" << name << " " << "回复对象:" << Rc << " " << "时间:" << gettime() << endl;
	}
	else refile << '"' << message << '"' << " " << "回复人:" << name << " " << "回复对象:" << Rc << " " << "时间:" << gettime() << endl;
	refile.close();
	cout << "您已成功回复!" << endl;
}

bool show_My_Reply_message(string &name) {
	ifstream infile("Reply_message.txt");
	if (!infile) {
		cout << "文件信息有误或暂无发出回复！请先回复或重新进入!" << endl;
		return false;
	}
	string line, cname, hname;
	int i = 0;
	while (getline(infile, line)) {
		size_t pos = 0, pos1 = 0;
		pos = findspaceoutside(line, 1);
		cname = line.substr(pos + 8);
		pos = cname.find_first_of(' ');
		cname = cname.substr(0, pos);//回复人的名字
		pos1 = findspaceoutside(line, 2);
		hname = line.substr(pos1 + 10);
		//cout << cname << endl;
		//cout << hname<<endl;
		if (cname == name) {
			i++;
			cout << "我的第" << i << "条回复:" << endl;
			if ((sizeof(hname)) > 4) {
				string tname = hname.substr(0, 4);
				if (tname == "Hide") {
					size_t pos2 = 0;
					pos2 = findspaceoutside(line, 1);
					string str1 = line.substr(0, pos2 + 1);
					pos2 = findspaceoutside(line, 3);
					//cout << str1<<endl;
					string str2 = str1 + "回复对象:匿名" + line.substr(pos2);
					cout << str2 << endl;
				}
				else {
					size_t pos3 = 0, pos4 = 0;
					pos3 = findspaceoutside(line, 1);
					pos4 = findspaceoutside(line, 2);
					string str = line.substr(0, pos3 + 1) + line.substr(pos4 + 1);
					cout << str << endl;
				}
			}
		}
	}
	infile.close();
	if (i > 0) return false;
	if (i == 0) {
		cout << "您暂未发出回复!" << endl;
		return true;
	}
}

bool show_My_bottle(string &name) {
	ifstream inbottle("漂流瓶.txt");
	if (!inbottle) {
		cout << "文件信息有误!请重新进入!" << endl;
		return false;
	}
	string line, cname;
	int i = 0;
	while (getline(inbottle, line)) {
		size_t pos1 = 0, pos2 = 0;
		pos1 = findspaceoutside(line, 1);
		pos2 = findspaceoutside(line, 2);
		cname = line.substr(pos1 + 8, pos2 - pos1 - 8);
		//cout << cname<<endl;
		if (cname == name) {
			i++;
			cout << "您扔出的第" << i << "个漂流瓶为:" << endl;
			cout << line << endl;
		}
	}
	inbottle.close();
	if (i > 0) return false;
	if (i == 0) {
		cout << "您暂未发出漂流瓶!" << endl;
		return true;
	}
}

bool show_Reply_to_me(string &name) {
	ifstream readin("Reply_message.txt");
	if (!readin) {
		cout << "文件信息有误!请重新进入!" << endl;
		return false;
	}
	string line, cname;
	int i = 0;
	while (getline(readin, line)) {
		size_t pos1 = 0;
		pos1 = findspaceoutside(line, 2);
		cname = line.substr(pos1 + 10);//回复对象的名字
		pos1 = cname.find_first_of(" ");
		cname = cname.substr(0, pos1);
		//cout << cname << "!" << endl;
		if ((sizeof(cname)) > 4) {
			string tname = cname.substr(0, 4);
			if (tname == "Hide") {
				cname = cname.substr(4, findspaceoutside(line, 3));
			}
		}
		//cout << cname << endl;
		if (cname == name) {
			i++;
			string str0;
			str0 = line.substr(0, 4);
			if (str0 == "Hide") {
				string str = line.substr(4, findspaceoutside(line, 1) - 3) + "回复人:匿名" + line.substr(findspaceoutside(line, 3));
				cout << "我收到的第" << i << "条回复:" << endl;
				cout << str << endl;
			}
			else {
				string str = line.substr(0, findspaceoutside(line)) + line.substr(findspaceoutside(line, 3));
				cout << "我收到的第" << i << "条回复:" << endl;
				cout << str << endl;
			}
		}
	}
	readin.close();
	if (i > 0) return false;
	if (i == 0) {
		cout << "您暂未收到回复!" << endl;
		return true;
	}

}

bool frRe(string& name,string &fr) {
	ifstream input("friend.txt", ios::in);
	if (!input)//文件打开失败:
	{
		cout << "无法打开文件:'friend.txt'!请检查或创建之后重新进入!" << endl;
		return false;
	}
	string user,f;
	vector<string> strs;
	string str;
	while (getline(input, str)) {
		strs.push_back(str);
	}
	input.close();
	for (int i = 0; i < strs.size(); i++) {
		size_t s = findspaceoutside(strs[i], 1);
		f = strs[i].substr(7, s-7);
		user = strs[i].substr(s + 6);
		//cout << name << "!" << endl;
		if (f== fr&&user==name) {
			return false;
		}
	}
	return true;
}

bool checkRe(string& name,string &fr) {
	ifstream check("check.txt", ios::in);
	if (!check)//文件打开失败:
	{
		cout << "无法打开文件:'friend.txt'!请检查或创建之后重新进入!" << endl;
		return false;
	}
	string user,f;
	vector<string> strs;
	string str;
	while (getline(check, str)) {
		strs.push_back(str);
	}
	check.close();
	for (int i = 0; i < strs.size(); i++) {
		size_t s = findspaceoutside(strs[i],2);
		size_t k= findspaceoutside(strs[i],1);
		user= strs[i].substr(s+10);
		f = strs[i].substr(k + 9, s - k - 9);
		//cout << user << "!" << endl;cout << user << "!" << endl;
		if (user==name&&f==fr) {
			cout << "已发送过验证消息!" << endl;
			return false;
		}
	}
	return true;
}

bool Check_friend(string& name) {
	ifstream input("friend.txt", ios::in);
	if (!input)//文件打开失败:
	{
		cout << "无法打开文件:'friend.txt'!请检查或创建之后重新进入!" << endl;
		return false;
	}
	ifstream reading("User_in.txt", ios::in);
	if (!reading)//文件打开失败:返回0
	{
		cout << "无法打开文件'User_in'!请检查或创建之后重新进入!" << endl;
		return false;
	}

	string Name, fr;
	int k = 0;
	vector<string> lines, strs;
	string line, str;
	while (getline(input, str)) {
		strs.push_back(str);
	}
	input.close();
	for (int i = 0; i < strs.size(); i++) {
		size_t s = findspaceoutside(strs[i], 1);
		Name = strs[i].substr(s + 6);
		fr = strs[i].substr(7, s - 7);
		if (Name == name) { cout << "您的第" << k + 1 << "个好友为:" << fr << endl; k++; }
	}
	if (k == 0) cout << "你暂无好友!" << endl;
	char op;
	do {
		cout << "***************************" << endl;
		cout << "请选择操作:" << endl;
		cout << "a:添加好友" << endl << "c:查看好友漂流瓶往来" << endl;
		cout << "***************************" << endl;
		cin >> op;
		cin.ignore(numeric_limits<streamsize>::max(), '\n');
		if (op == 'a') {
			ofstream check("check.txt", ios::app);
			if (!check)//文件打开失败:
			{
				cout << "无法打开文件:'check.txt'!请检查或创建之后重新进入!" << endl;
				return false;
			}
			while (getline(reading, line)) {
				lines.push_back(line);
			}
			reading.close();
			int retf = 0;
			cout << "目前所有漂流瓶用户(不包括自己):" << endl;
			for (int i = 0; i < lines.size(); i++) {
				size_t s1 = findspaceoutside(lines[i], 1), s2 = findspaceoutside(lines[i], 2);
				Name = lines[i].substr(s1 + 1, s2 - s1 - 1);
				if (Name != name) {
					cout << Name << endl;
					retf++;
				}
			}
			if (retf == 0) cout << "目前暂无其他用户" << endl;
			if (retf != 0) {
				cout << "请输入你想添加的好友的名字:" << endl;
				getline(cin, fr);
				int ret = 0;
				for (int i = 0; i < lines.size(); i++) {
					size_t s1 = findspaceoutside(lines[i], 1), s2 = findspaceoutside(lines[i], 2);
					Name = lines[i].substr(s1 + 1, s2 - s1 - 1);
					if (fr == Name) {
						ret = 1;
						if ((frRe(name, fr)) == false) cout << "该好友已存在!" << endl;
						else {
							if (checkRe(name, fr) == true) {
								check << "Friend Request:" << fr << " " << "来自用户:" << name << endl;
								cout << "已发送验证消息！" << endl;
								break;
							}
						}
					}
				}
				if (ret == 0) cout << "暂无此人!" << endl;
			}
		}
		else if (op == 'c') {
			if (k == 0) cout << "你暂无好友!" << endl;
			else {
				cout << "请输入你想查看的好友漂流瓶往来:" << endl;
				int r = 0;
				cin >> fr;
				if (frRe(name, fr) == true) cout << "你没有该好友!" << endl;
				else {
					ifstream chat("chat.txt", ios::in);
					if (!chat) {
						cout << "无法打开文件'chat.txt', 请检查!" << endl;
						return false;
					}
					vector<string> ss;
					string s, f, u;
					size_t t = 0, t1 = 0, t2 = 0;
					while (getline(chat, s)) {
						ss.push_back(s);
					}
					for (int i = 0; i < ss.size(); i++) {
						t = findspaceoutside(ss[i], 1);
						t1 = findspaceoutside(ss[i], 2);
						t2 = findspaceoutside(ss[i], 3);
						u = ss[i].substr(t + 8, t1 - t - 8);
						f = ss[i].substr(t1 + 10, t2 - t1 - 10);
						//cout << u << "!" << endl;
						//cout << f << "!" << endl;
						if ((u == name && f == fr)) {
							cout << ss[i].substr(0, t - 2) << ss[i].substr(t1) << endl; r++;
						}
						else if (u == fr && f == name) {
							cout << ss[i].substr(0, t - 2) << " 发送给好友:" << fr << ss[i].substr(t2) << endl; r++;
						}
					}
					if (r == 0) cout << "你们暂无漂流瓶往来!" << endl;
				}
			}
		}
		else break;
		cout << "你想继续好友操作吗?(y/Y):" << endl;
		cin >> op;
		cin.ignore(numeric_limits<streamsize>::max(), '\n');
	} while (op == 'y' || op == 'Y');
}

bool Vali_message(string& name) {
	ifstream in("check.txt", ios::in);
	if (!in) {
		cout << "无法打开文件'User_in'!请检查或创建之后重新进入!" << endl;
		return false;
	}
	int ret = 0;
	string s, fr,user;
	vector<string> ss;
	while (getline(in, s)) {
		ss.push_back(s);
	}
	for (int i = 0; i < ss.size(); i++) {
		size_t p = 0, t = 0;
		t = p = findspaceoutside(ss[i], 1);
		p = findspaceoutside(ss[i], 2);
	    user = ss[i].substr(p + 10);
		fr = ss[i].substr(t + 9, p - t - 9);
		//cout << user << "!" << endl;
		//cout << fr << "!" << endl;
		if (fr == name) {
			if (frRe(name,user) == true){
				cout << "好友请求！" << ss[i].substr(p + 1) << endl;
				ret = 1;
				break;}
		}
	}
	if (ret == 0) cout << "暂无验证消息" << endl;
	else {
		cout << "是否同意该好友请求?(y/Y):" << endl;
		char op;
		cin >> op;
		cin.ignore(numeric_limits<streamsize>::max(), '\n');
		if (op == 'y' || op == 'Y') {
			ofstream input("friend.txt", ios::app);
			if (!input) {
				cout << "无法打开文件'User_in'!请检查或创建之后重新进入!" << endl;
				return false;
			}
			input << "Friend:" << user << " " << "用户:" << name << endl;
			input << "Friend:" << name << " " << "用户:" << user << endl;
			cout << "添加成功!" << endl;
			input.close();
		}
	}
}

bool Directed_chat(string& name) {
	ifstream input("friend.txt", ios::in);
	ofstream chat("chat.txt", ios::app);
	if (!input)//文件打开失败:
	{
		cout << "无法打开文件:'friend.txt'!请检查或创建之后重新进入!" << endl;
		return false;
	}
	if (!chat)//文件打开失败:
	{
		cout << "无法打开文件:'chat.txt'!请检查或创建之后重新进入!" << endl;
		return false;
	}
	vector<string> strs;
	string str,fr,word;
	while (getline(input, str)) {
		strs.push_back(str);
	}
	input.close();
	cout << "请输入你想扔漂流瓶的好友:" << endl;
	getline(cin, fr);
	if (frRe(name, fr) == true) cout << "你没有该好友!" << endl;
	else {
				cout << "请输入你想写的话语:" << endl;
				getline(cin, word);
				chat << '"' << word << '"' << "to friend:"<<fr<<" "<< "来自好友:" << name << " " << "时间:" << gettime() << endl;
	}
}

bool Achievement(string &name) {
	ifstream put("achievement.txt", ios::in);
	if (!put)//文件打开失败:
	{
		cout << "无法打开文件:'achievement.txt'!请检查或创建之后重新进入!" << endl;
		return false;
	}
	//if (put.peek()==ifstream::traits_type::eof) cout << "暂无任何成就!" << endl;
	int ret = 0;
	vector<string> strs;
	string str;
	while (getline(put, str)) {
		strs.push_back(str);
	}
	for (int i = 0; i < strs.size(); i++) {

	}
}

int main() {
	int x;
	User user;
	user.Loading();
	string id, name, password;
	gettime();
	cout << "****欢迎进入漂流瓶系统!****" << endl;
	do {
		cout << "请选择您想进行的操作:" << endl << "1.注册" << endl << "2.登录" << endl << "其他:退出" << endl;
		cout << "***************************" << endl;
		cin >> x;
		if (x == 1) {
			cout << "请输入您要注册的ID（可使用字母和阿拉伯数字）：" << endl;
			cin >> id;
			while ((user.IsRepetition(id)) == true)
			{
				cout << "对不起，您注册的ID已存在,请重新注册!" << endl;
				cout << "请输入您要注册的ID（可使用字母和阿拉伯数字）：" << endl;
				cin >> id;
			}
			cin.ignore(numeric_limits<streamsize>::max(), '\n');
			cout << "请输入您喜欢的昵称：" << endl;
			cin >> name;
			cin.ignore(numeric_limits<streamsize>::max(), '\n');
			cout << "请设置您的密码：" << endl;
			cin >> password;
			cin.ignore(numeric_limits<streamsize>::max(), '\n');
			user.Register(id, name, password);
			cout << "***************************" << endl;
		}
		else if (x == 2) {
			int check = 0;
			do {
				cout << "请输入您的ID:" << endl;
				cin >> id;
				cin.ignore(numeric_limits<streamsize>::max(), '\n');
				cout << "请输入您的密码:" << endl;
				getline(cin, password);
				//	cin.ignore(numeric_limits<streamsize>::max(), '\n');
				check = user.Login(id, password, name);
				if (check == 1) {
					cout << "是否重新登录？" << endl;
					char m;
					cin >> m;
					if (m == 'y' || m == 'Y') {
						;
					}
					else exit(0);
				}
			} while (check == 1);
		}
		else {
			cout << "感谢使用，再见！" << endl;
			exit(0);
		}
	} while (x == 1);

	char op;
	do {
		cout << "****************************" << endl;
		cout << "请选择您想进行的操作:" << endl;
		cout << "t:扔漂流瓶" << endl << "p:捡漂流瓶" << endl;
		cout << "1.查看已发出的漂流瓶(Hide表示匿名扔出)" << endl;
		cout << "2.查看我发出的回复" << endl;
		cout << "3.查看我收到的回复" << endl;
		cout << "4.查看我的好友" << endl;
		cout << "5.查看验证消息" << endl;
		cout << "6.好友定向扔漂流瓶(私密)" << endl;
		//cout << "7.查看我获得的成就:" << endl;
		cout << "0:退出程序" << endl;
		cout << "****************************" << endl;
		cin >> op;
		cin.ignore(numeric_limits<streamsize>::max(), '\n');
		if (op == 't') {
			throw_bottle(name);
		}
		else if (op == 'p') {
			char op2;
			string Rc;
			if ((pick_bottle(Rc, name)) == true) {
				cout << "你想回复这条漂流瓶吗？(y/Y)" << endl;
				cin >> op2;
				cin.ignore(numeric_limits<streamsize>::max(), '\n');
				if (op2 == 'y' || op2 == 'Y') {

					Reply_message(name, Rc);
				}
				else cout << "你没有选择回复!" << endl;
			}
		}
		else if (op == '1') {
			show_My_bottle(name);
		}
		else if (op == '2') {
			show_My_Reply_message(name);
		}
		else if (op == '3') {
			show_Reply_to_me(name);
		}
		else if (op == '4') {
			Check_friend(name);
		}
		else if (op == '5') {
			Vali_message(name);
		}
		else if (op == '6') {
			Directed_chat(name);
		}
		/*else if (op == '7') {
			;
		}*/
	} while (op != '0');
	return 0;
}



// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
// 调试程序: F5 或调试 >“开始调试”菜单

// 入门使用技巧: 
//   1. 使用解决方案资源管理器窗口添加/管理文件
//   2. 使用团队资源管理器窗口连接到源代码管理
//   3. 使用输出窗口查看生成输出和其他消息
//   4. 使用错误列表窗口查看错误
//   5. 转到“项目”>“添加新项”以创建新的代码文件，或转到“项目”>“添加现有项”以将现有代码文件添加到项目
//   6. 将来，若要再次打开此项目，请转到“文件”>“打开”>“项目”并选择 .sln 文件
